<template>
  <div class="app-container">

    <!--查询表单-->
    <el-form :inline="true" class="demo-form-inline">
      <el-form-item>
        <el-input v-model="feedbackQuery.userId" placeholder="用户ID"/>
      </el-form-item>

      <el-button type="primary" icon="el-icon-search" @click="searchList()">查询</el-button>
      <el-button type="default" @click="resetData()">清空</el-button>
    </el-form>

    <!-- 表格 -->
    <el-table
      :data="list"
      border
      fit
      highlight-current-row>

      <el-table-column
        type="index"
        label="序号"
        width="70"
        align="center">
      </el-table-column>

      <el-table-column
        prop="userId"
        label="用户id"
        width="348"
        align="center">
      </el-table-column>

      <el-table-column
        prop="feedbackComment"
        label="反馈内容"
        width="1000"
        align="center">
      </el-table-column>

      <el-table-column
        prop="gmtCreate"
        label="反馈时间"
        width="280"
        align="center">
      </el-table-column>

    </el-table>

    <!-- 分页 -->
    <el-pagination
      :current-page="page"
      :page-size="limit"
      :total="total"
      style="padding: 30px 0; text-align: center;"
      layout="total, prev, pager, next, jumper"
      @current-change="getList"
    />

  </div>
</template>
<script>
//引入调用list.js文件
import feedback from '@/api/wd/feedback'

export default {
  data() { //定义变量和初始值
    return {
      list: null,//查询之后接口返回集合
      page: 1,//当前页
      limit: 10,//每页记录数
      total: 0,//总记录数
      feedbackQuery:{}

    }
  },
  created() { //页面渲染之前执行，一般调用methods定义的方法
    //调用
    this.getList()
  },
  methods: {
    getList(page = 1) {
      this.page = page
      feedback.getFeedbackList(this.page, this.limit)
        .then(response => {
          this.list=response.data.list
          this.total=response.data.total
        })
    },
    //带条件查询
    searchList(page = 1) {
      this.page = page
      feedback.searchFeedbackList(this.page, this.limit,this.feedbackQuery)
        .then(response => {
          this.list=response.data.list
          this.total=response.data.total
        })
    },
    resetData(){
      this.feedbackQuery={}
      this.getList()
    }

  }


}
</script>
